<template>
  <div class="container">

    <div class="ibox-content no-border no-padding-bottom">
      <!--搜索栏-->
      <el-col class="toolbar">
        <el-form :model="filterForm" :inline="true" size="small" label-width="80px" ref="filterForm">
          <el-form-item label="id">
            <el-input v-model="filterForm.id" placeholder="id"></el-input>
          </el-form-item>
          <el-form-item label="用户id">
            <el-input v-model="filterForm.uid" placeholder="精确匹配用户id"></el-input>
          </el-form-item>
          <el-form-item label="用户">
            <el-input v-model="filterForm.user_phone" placeholder="用户"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button @click.native="filterClick" type="primary">查询</el-button>
            <el-button @click.native="resetFilterForm('filterForm')">重置</el-button>
          </el-form-item>
        </el-form>
      </el-col>
    </div>
    <div class="ibox-content">
      <!--表格-->
      <el-table
              ref="multipleTable"
              :data="arrList"
              size="medium"
              border
              highlight-current-row
              tooltip-effect="dark"
              style="width: 100%"
              :max-height="500"
              v-loading="tableLoading"
      >
        <el-table-column prop="id" label="用户ID" width="100" fixed="left"></el-table-column>
        <el-table-column prop="uid" label="用户ID" width="120"></el-table-column>
        <el-table-column prop="user_phone" label="用户"></el-table-column>
        <el-table-column prop="amount" label="提现金额">
          <template slot-scope="scope">
            <span>￥{{scope.row.amount}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="created_at" label="申请时间"></el-table-column>
      </el-table>

      <!--分页工具条-->
      <div v-show="arrList.length>0" style="margin-top: 18px;text-align: center">
        <el-pagination
                @current-change="handleCurrentChange"
                :current-page="pageInfo.currPage"
                :page-sizes="[20]"
                :page-size="pageInfo.pageSize"
                layout="total, sizes, prev, pager, next, jumper"
                :total="pageInfo.totalCount">
        </el-pagination>
      </div>


    </div>

  </div>
</template>

<script>
  import {withdrawalRecord} from "../../api/user";

  export default {
    name: "rateCardApplyWithdrawal",
    data() {
      return {
        arrList: [],
        pageInfo: {
          totalPage: 0,// 总页数
          totalCount: 0,// 总条数
          pageSize: 0,// 每页条数
          currPage: 1// 当前页
        },
        filterForm: {},
        tableLoading: false,
        tableSelectData: [],
        selectOptions: {}
      }
    },
    created() {
      this.initData();
    },
    methods: {
      initData() {
        this.tableLoading = true;
        withdrawalRecord({
          page: this.pageInfo.currPage,
          ...this.filterForm
        }).then(res => {
          this.tableLoading = false;
          const {listData, page} = res.data;
          this.arrList = listData;
          this.pageInfo = page
        }).catch(() => {
          this.tableLoading = false;
        })
      },
      //分页
      handleCurrentChange(val) {
        // console.log(val);
        this.pageInfo.currPage = val;
        this.initData();
      },
      //查询
      filterClick() {
        this.pageInfo.currPage = 1;
        this.initData();
      },
      //重置
      resetFilterForm(form) {
        this.$refs[form].resetFields();
        this.filterForm = {};
        this.pageInfo.currPage = 1;
        this.initData();
      },
    }
  }
</script>

<style scoped lang="scss">

</style>
